//
//  WWNavigationController.swift
//  SinWEiBo
//
//  Created by 胡良志 on 2018/3/11.
//  Copyright © 2018年 HuLiangZhi. All rights reserved.
//

import UIKit

class WWNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
//
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {

        let count = childViewControllers.count
        if count > 0 {
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(pushView))
             viewController.hidesBottomBarWhenPushed = true
        }
        //
       super .pushViewController(viewController, animated: animated)
    }
    @objc private func pushView() {
        
        self.popViewController(animated: true)
    }

}
